<?php
/**
 * Created by PhpStorm.
 * UsersF: Mloong
 * Date: 2019/3/2
 * Time: 10:34
 */

namespace app\sign\model;


class Account extends BaseModel
{
    public function sign()
    {
        return $this->hasMany('Sign', 'user_id', 'id');
    }

    public function getSignInfo($name, $data)
    {
        return self::with([
            'sign' => function($query) use ($data){
                $query->where('sign', '=', $data['sign']);
            }
        ])->where('name', '=', $name)
            ->find();
//        return self::alias('a')
//            ->json(['SignService'=>'s'], 'a.id = s.user_id')
//            ->where('sign','=', $data['sign'])
//            ->select();
    }
}